//1  显示一个提示信息，内容为str
function showtimediv(str, title) {
    $("#divinfobgbox").remove();
    $("#divtimebox").remove();
    if ($("#divinfobgbox").length <= 0) {
        $("body").append("<div id='divinfobgbox' onclick='codefans()'></div>" + "<div id='divtimebox'  onclick='codefans()'><div class='divtimebox1'>温馨提示</div><hr style='border:0;background-color:#CCC;height:2px;margin: 0px;padding: 0px;'><div class='divtimebox2'>这里是文字提示</div></div>");
    }
    if (title) {
        $("#divtimebox .divtimebox1").html(title);
    }
    $("#divtimebox .divtimebox2").html(str);
    $("#divinfobgbox").show();
    $("#divtimebox").show();
    var t = document.documentElement.scrollTop || document.body.scrollTop;
    document.getElementById("divinfobgbox").style.top = t + 'px';
    document.getElementById("divtimebox").style.top = t + 60 + 'px';

    setTimeout("codefans()", 3000); //3秒
}


//1  显示一个提示信息，内容为str
function showconfirmdiv(title) {
    $("#divinfobgbox").remove();
    $("#divtimebox").remove();
    if ($("#divinfobgbox").length <= 0) {
        $("body").append("<div id='divinfobgbox'></div><div id='divtimebox' ><div class='divtimebox1'>温馨提示</div><hr style='border:0;background-color:#CCC;height:1px;'>" +
            "<div class='divtimebox2'>姓名：<input id='name' maxlength='10' type='text' > <input type='button' value='确认' onclick='confirmname()'> </div></div>");
    }
    if (title) {
        $("#divtimebox .divtimebox1").html(title);
    }

    $("#divinfobgbox").show();
    $("#divtimebox").show();
    var t = document.documentElement.scrollTop || document.body.scrollTop;
    document.getElementById("divinfobgbox").style.top = t + 'px';
    document.getElementById("divtimebox").style.top = t + 20 + 'px';

}

function codefans() {
    $("#divinfobgbox").hide();
    $("#divtimebox").hide();
}

// 格式化日对象
function getNowDate(){
    var date = new Date();
    var sign2 = ":";
    var year = date.getFullYear() // 年
    var month = date.getMonth() + 1; // 月
    var day = date.getDate(); // 日
    var hour = date.getHours(); // 时
    var minutes = date.getMinutes(); // 分
    var seconds = date.getSeconds() //秒
    var weekArr = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
    var week = weekArr[date.getDay()];
    // 给一位数的数据前面加 “0”
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (day >= 0 && day <= 9) {
        day = "0" + day;
    }
    if (hour >= 0 && hour <= 9) {
        hour = "0" + hour;
    }
    if (minutes >= 0 && minutes <= 9) {
        minutes = "0" + minutes;
    }
    if (seconds >= 0 && seconds <= 9) {
        seconds = "0" + seconds;
    }
    return year + "-" + month + "-" + day + " " + hour + sign2 + minutes + sign2 + seconds;
}


function commonsleep(n) { //n表示的毫秒数
    var start = new Date().getTime();
    while (true) if (new Date().getTime() - start > n) break;
}

